import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 徐海涛
 * Date: 2022-04-17
 * Time: 18:18
 */
public class Demo1 {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s1 = sc.next();
        String s2 = sc.next();
        int ln1 = s1.length();
        int ln2 = s2.length();
        int p = -1; //记录当前为 * 的下标
        int q = -1; // 记录当前为 * 对应的匹配字符串的下标
        int j = 0;  //记录通配符字符串的下标
        for(int i = 0;i < ln2;){
            if(j < ln1 && s1.charAt(j) == '*'){
                p = ++j;
                q = i;
            }else if(j < ln1 && s1.charAt(j) == '?' && ('0' <= s2.charAt(i) && s2.charAt(i) <= '9' ||
                    'a' <= s2.charAt(i) && s2.charAt(i) <= 'z' ||
                    'A' <= s2.charAt(i) && s2.charAt(i) <= 'Z')){
                j++;
                i++;
            }else if(j < ln1 && (s1.charAt(j) == s2.charAt(i) || (s1.charAt(j) - s2.charAt(i) == 32 ) || (s1.charAt(j) - s2.charAt(i) == -32 ))){
                j++;
                i++;
            }else if(p >= 0){
                j = p;
                i = ++q;
            }else{
                System.out.println(false);
                return;
            }
        }
        while(j < ln1 && s1.charAt(j) == '*'){
            j++;
        }
        System.out.println(j == ln1);
    }
}
